# -*- coding: utf-8 -*-
"""
@Author: Logan
@Date:   2025/6/30 17:47
@Description: 
"""


class GoodsBase:

    def goods_textarea(self, placeholder_value):
        """
        商品标题/详情
        :return:
        """
        return f"//form[@class='el-form']//textarea[@placeholder=\"请输入商品{placeholder_value}\"]"

    def goods_num(self, plus=True):
        """
        商品数量
        :param plus:True表示使用加号，False表示直接输入
        :return:
        """
        if plus:
            return "//label[@for='product_stock']/following-sibling::div//i[@class='el-icon-plus']/parent::span"
        else:
            return "//form[@class='el-form']//input[@placeholder='商品数量']"

    def goods_img(self):
        """
        商品图片
        :return:
        """
        return "//input[@type='file']"

    def goods_price(self):
        """
        商品单价
        :return:
        """
        return "//form[@class='el-form']//input[@placeholder='请输入商品单价']"

    def goods_status(self):
        """
        商品状态
        :return:
        """
        return "//form[@class='el-form']//input[@placeholder='请选择商品状态']"

    def goods_status_select(self, status):
        """
        请选择商品状态
        :param status:
        :return:
        """
        return "//span[text()='" + status + "']/parent::li"

    def add_goods_bottom_button(self, button_name):
        """
        新增二手商品底部按钮
        :param button_name: 提交、重置
        :return:
        """
        return "//span[text()='" + button_name + "']/parent::button"


if __name__ == '__main__':
    print(GoodsBase().goods_textarea('标题'))
